package ace.module.captcha.sms.core.impl.api.impl;

import ace.cmp.core.model.R;
import ace.module.captcha.sms.api.CaptchaSmsItemApi;
import ace.module.captcha.sms.api.model.dto.CaptchaSmsItemDto;
import ace.module.captcha.sms.core.impl.dao.entity.CaptchaSmsItem;
import ace.module.captcha.sms.core.impl.manager.CaptchaSmsItemManager;
import ace.module.common.api.annotation.ApiLocalPriority;
import ace.module.common.core.impl.api.impl.SdkApiImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;


/**
 * 验证码 api implements.
 *
 * @author Caspar
 *
 */
@ApiLocalPriority
@AllArgsConstructor
@Component
public class CaptchaSmsItemApiImpl
    extends SdkApiImpl<CaptchaSmsItem, Long, CaptchaSmsItemDto, CaptchaSmsItemManager>
    implements CaptchaSmsItemApi {

  private final CaptchaSmsItemManager captchaSmsItemManager;

  @Override
  public R<CaptchaSmsItemDto> getByCaptchaSmsAppIdAndPhone(Long captchaSmsAppId, String phone) {
    CaptchaSmsItemDto result = captchaSmsItemManager.getDtoByCaptchaSmsAppIdAndPhone(captchaSmsAppId, phone);
    return R.ok(result);
  }
}
